<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" import="java.util.ArrayList,dao.*" pageEncoding="utf-8"%>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gbk" />
    <title>开始考试</title>
  </head>
  <script type="text/javascript"> 
var url = location.search; 
url = url.replace("?",""); 
var urlItems = url.split("&"); 
var _a = urlItems[1].split("="); 
var m=_a[1]; //a【1】
var _b = urlItems[2].split("="); 
var h=_b[1]; 
//var h=1; //设置考试时间(小时单位) 
//var m=30; //设置考试时间(分钟单位) 
var timeShowId="timeshow"; //设置时间显示层ID 
var TimeNum=h*60*60+m*60; 
var timeStr; 
function ChangeTime(){ 
TimeNum--; 
if(TimeNum > 0){ 
timeStr=setTimeout("ChangeTime()",1000); 
} 
else{ 
document.form1.submit(); 
} 
document.getElementById(timeShowId).innerHTML="在线考试系统提示你的时间还剩"+Math.floor(TimeNum/60)+"分"+Math.floor(TimeNum%60)+"秒"; 
//window.status="在线考试系统提示你的时间还剩"+Math.floor(TimeNum/60)+"�?+TimeNum%60+"�?; 
} 
</script> 
<body onload="ChangeTime()">
<div id="timeshow" style="position:absolute;left:1px;top:1px;width:250px;height:20px;line-height:20px;text-align:center;font-size:12px;color:#000;background-color:#CCC;border:1px solid #333;"></div> 
<br /> 
<div id="main-wrapper">
  <div id="navigation">
   <ul> <li>欢迎${sessionScope.studentName}同学来到考试界面</li>
        <li>选择题（只有一个正确答案）</li></ul>  
</div>
<form action="checkanswer" method="post" name="form1" id="form1" >
<%
	String eid=request.getParameter("eid");
	//int hour=Integer.parseInt(request.getParameter("hour").toString().trim());
	//int minite=Integer.parseInt(request.getParameter("minite").toString().trim());
	ArrayList<String> uanswer = new ArrayList<String>();
	ArrayList<String> qnumber = new ArrayList<String>();
	int j=1;
	QuestionDao dao = new QuestionDao();
	int count=dao.getQuestionCount();
	for(int i=1;i<=count;i++) {
	String qid=dao.getIdOfLine(i);
	String search=dao.getEid(Integer.parseInt(qid));
	if (eid.equalsIgnoreCase(search)){
		out.print(j+"."+"&nbsp");
		qnumber.add(qid);
		out.print(dao.getQuestion(Integer.parseInt(qid))+"<br/>");
%>
	<input type="radio" name="answer<%=j%>" value="A"/>
<%
	out.print(dao.getkeya(Integer.parseInt(qid)));
 %>
 <input type="radio" name="answer<%=j%>" value="B"/>
<%
	out.print(dao.getkeyb(Integer.parseInt(qid)));
 %>
 <input type="radio" name="answer<%=j%>" value="C"/>
<%
	out.print(dao.getkeyc(Integer.parseInt(qid)));
 %>
 <input type="radio" name="answer<%=j%>" value="D"/>
<%
	out.print(dao.getkeyd(Integer.parseInt(qid))+"<br/>");
%>
<% 
	uanswer.add(dao.getanswer(Integer.parseInt(qid)));
	j++;
	}
	}
 %>
 <%
 	session.setAttribute("eid",eid);
 	session.setAttribute("uanswer",uanswer);
 	session.setAttribute("qnumber",qnumber);
  %>
 <input type="submit" value="交卷"/>

</form>
</div>
</body>
</html>
